//
// Shared Stack
// Created by Win10 on 2022/10/31.
//

#ifndef C_DATA_STRUCTURE_SH_STACK_H
#define C_DATA_STRUCTURE_SH_STACK_H

#define MaxSize 10

typedef int ElemType;

typedef struct {
    ElemType data[MaxSize];
    int top0;
    int top1;
} ShStack;

void InitStack(ShStack &S);

bool StackEmpty(ShStack S);

bool StackFull(ShStack S);    //判断栈是否满了
bool Push0(ShStack &S, ElemType x);

bool Push1(ShStack &S, ElemType x);

bool Pop0(ShStack &S, ElemType &x);

bool Pop1(ShStack &S, ElemType &x);

bool GetTop0(ShStack S, ElemType &x);

bool GetTop1(ShStack S, ElemType &x);

bool DestoryStack0(ShStack &S);

bool DestoryStack1(ShStack &S);

void InitStack(ShStack &S) {
    S.top0 = -1;
    S.top1 = MaxSize;
}

#endif //C_DATA_STRUCTURE_SH_STACK_H

